<?php
namespace app\controllers\api\category;

use app\libs\Util;
use app\models\Category;

class ListController extends \fate\web\PureController {
    public function run() {
        $data = (new Category())->getListByCondition('id, pid, name', '1=1');
        $data = Util::listToTree($data);

        $this->ajaxReturn([
            'data' => $data
        ]);
    }
}
